use compare_pointer::compare_pointer::{pointer_compare, pointer_equal};

#[test]
fn test_pointer_compare() {
    let array = [0, 1, 2, 3, 4];

    // Negative if first argument is a lower memory address than the second
    assert!(pointer_compare(&array[0] as *const _ as *const (), &array[4] as *const _ as *const ()) < 0);

    // Positive if the first argument is a higher memory address than the second
    assert!(pointer_compare(&array[3] as *const _ as *const (), &array[2] as *const _ as *const ()) > 0);

    // Zero if the two arguments are equal
    assert!(pointer_compare(&array[4] as *const _ as *const (), &array[4] as *const _ as *const ()) == 0);
}

#[test]
fn test_pointer_equal() {
    let a = 0;
    let b = 0;

    // Non-zero (true) if the two pointers are equal
    assert!(pointer_equal(&a as *const _ as *const (), &a as *const _ as *const ()));

    // Zero (false) if the two pointers are not equal
    assert!(!pointer_equal(&a as *const _ as *const (), &b as *const _ as *const ()));
}